package org.myspringmvc.web.servlet.mvc.method.annotation;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.myspringmvc.ui.ModelMap;
import org.myspringmvc.web.servlet.HandlerAdapter;
import org.myspringmvc.web.servlet.ModelAndView;

/**
 * @Author 海晨忆
 * @Des 处理器适配器
 * @Date 2025/7/17 10:22
 */
public class RequestMappingHandlerAdapter implements HandlerAdapter {
    @Override
    public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        ModelAndView mv = new ModelAndView();
        mv.setViewName("index");
        ModelMap model = new ModelMap();
        model.addAttribute("username", "zhangsan");
        mv.setModel(model);
        return mv;
    }
}
